package com.block.api.controller.admin;

import com.alibaba.fastjson.JSONObject;
import com.block.account.service.IAccountApplyRecordService;
import com.block.common.bean.CommonParam;
import com.block.common.exception.ApiException;
import com.block.common.security.util.ApiUtil;
import com.block.common.vo.ResponseVo;
import com.block.db.entity.AppEncrypt;
import com.block.match.service.IDataMatchOrderInfoService;
import com.block.match.service.IMatchHandleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("api/admin/merchant")
@Validated
public class AdminMerchantController {

    @Autowired
    IMatchHandleService matchHandleService;

    /**
     * 用户登陆
     */
    @RequestMapping(value = "/pushManual", method = {RequestMethod.POST, RequestMethod.GET})
    public String enterAccount(@RequestAttribute(value = "tranData") JSONObject tranData,
                             @RequestAttribute(value = "appEncrypt") AppEncrypt appEncrypt,
                             @RequestAttribute(value = "uri") String uri,
                             @RequestAttribute(value = "commonParam") CommonParam commonParam,
                             @RequestAttribute(value = "startDate") Date startdate,
                             @RequestAttribute(value = "ip") String ip) throws ApiException {

        String infoId = tranData.getString("infoId");
        String uid = tranData.getString("uid");

        ResponseVo responseVo = matchHandleService.handlePushManual(infoId, uid);

        return ApiUtil.dealReturnJson(responseVo, appEncrypt,  startdate, uri);
    }

}
